<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/templateAdmin.xhtml">

	<ui:define name="content">
		<f:loadBundle basename="properties.messages" var="msg" />
		<f:view locale="#{language.locale}">

			<h:form class="CreateUser">
				<p class="CUTitle">#{msg.createNewUser}</p>
				
					<h:panelGrid columns="3">
						<h:outputText value="#{msg.username}" />
						<h:inputText id="uName" value="#{newUser.name}">
							<f:validator binding="#{userNameValidator}"
								validatorId="userNameValidator" />
							<f:ajax event="blur" render="uNameMess" />
						</h:inputText>
						<h:message id="uNameMess" for="uName" style="color:red" />

						<h:outputText value="#{msg.mail}"></h:outputText>
						<h:inputText id="uMail" value="#{newUser.email}">
							<f:validator binding="#{emailValidator}"
								validatorId="emailValidator" />
							<f:ajax event="blur" render="mailMess" />
						</h:inputText>
						<h:message id="mailMess" for="uMail" style="color:red" />


						<h:outputText value="#{msg.phone}"></h:outputText>
						<h:inputText id="uPhone" value="#{newUser.telephone}">
							<f:validator validatorId="phoneValidator" />
							<f:ajax event="blur" render="phoneMess" />
						</h:inputText>
						<h:message for="uPhone" id="phoneMess" style="color:red" />
						
						<h:outputText value="#{msg.repNameLabel}"></h:outputText>
						<h:selectOneMenu value="#{newUserController.selectedRep}">
				<f:selectItems value="#{addUserToRepController.notMemberRepList}"
					var="r" itemLabel="#{r.repName}" itemValue="#{r.id}" />
			</h:selectOneMenu>
					</h:panelGrid>
				
				<br />
				
					<h:commandButton class="CUButton" value="#{msg.createUser}"
						action="#{newUserController.adauga}">
					</h:commandButton>

				

			</h:form>
		</f:view>
	</ui:define>

</ui:composition>
</html>